#include <iostream>
#include <cstdlib>
#include <unistd.h>
#include <cstring>
using namespace std; 

int main(){
	extern char **environ;
	int i; 
	for(i = 0; environ[i]; i++){
		cout << environ[i] << endl;
	}
	cout << i << endl;
	
	char** s = (char**)malloc(i*sizeof(char*)); 
	if(s!= NULL)
		cout << "success\n" << endl; 
	memcpy(s,environ,i);
	for(int j = 0; j<i ;j++){
		s[j] = environ[j] ; 
		cout << "s[" << j<< "]=" <<s[j]<<endl;
	}
}
